FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 4094
EXPOSE 44311

FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY lottery.admin/lottery.admin.csproj lottery.admin/
RUN dotnet restore lottery.admin/lottery.admin.csproj
COPY . .
WORKDIR /src/lottery.admin
RUN dotnet build lottery.admin.csproj -c Release -o /app

FROM build AS publish
RUN dotnet publish lottery.admin.csproj -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "lottery.admin.dll"]
